Methods and apparatus for constructing declarative componentized applications

ABSTRACT

Techniques for constructing a software application are provided. A data model of the application is represented as a relational model. Control logic of the application is defined as a mapping from a current state of the application data model and one or more application inputs to a new state of the application data model and one or more application outputs, described by relational algebra components.

FIELD OF THE INVENTION

The present invention relates generally to approaches for constructing a user interactive software application and, more particularly, to techniques for constructing an interactive software application based on a relational model and relational algebra.

BACKGROUND OF THE INVENTION

Numerous attempts have been made to construct software applications out of “components,” or reusable pieces of software. These desired construction techniques are analogous to an often used manner of building hardware systems out of prepackaged pieces, more specifically chips, by creating custom interconnections. By using a construction approach utilizing components, it is believed that the software construction cost will be reduced or, alternatively, that the software construction productivity will increase, when compared to techniques that start anew for each new software application.

Software components declare a set of inputs and outputs, which are used to communicate with other components in the system. Such inputs and outputs may be considered analogous to pins on a chip in hardware system construction. Ideally the components are completely encapsulated, in that they only communicate via the declared input and output ports. The encapsulation of components provides numerous benefits. For example, encapsulated components may be replaced by other implementations, as long as the inputs, outputs, and semantics are identical. Additionally, applications built from encapsulated components are easier to analyze, optimize, and transform, because there is no need for the system to analyze internal implementations of the components.

An example of an encapsulated component system is the NIL programming language. See, for example, “A New Programming Methodology for Long-Lived Software Systems,” IBM J. Res. Develop., Vol. 28, No. 1, January 1984.

Another useful approach to reducing software complexity and improving software productivity is declarative programming. Declarative programming attempts to describe the desired behavior or goals of the system, the “what,” but leaves the specific implementation of the system, the “how,” undefined. In declarative programming it is reasoned that only the behavior is important, and a description of the implementation is an unnecessary loss of productivity. Examples of declarative programming languages include Haskell and Prolog. In contrast, most applications today are implemented in imperative programming languages, such as Java and C++. Imperative languages are used to describe the application using a step-by-step approach, for example, first, read input field 1; second, display a message in text-box 2.

Imperative languages typically have the concept of a “program counter” which indicates exactly where the flow of execution is at all times, and the ability to set “breakpoints”, which suspend the program when the flow of execution reaches a certain location in the program, utilized, for example, for debugging. In contrast, declarative programs do not have a concept analogous to a program counter. Note that declarative systems may be implemented using imperative languages.

Virtually all applications require access to data, which is typically stored in a database. A relational model, which provides access to data using relational algebra has been the most successful approach yet devised for storing and accessing data (see “A Relational Model of Data for Large Shared Data Banks”, Communications of the ACM, Vol 13 No. 6, June 1970). In its pure form, the relational model and algebra provide a declarative approach to accessing data. More specifically, they describe what data is desired, but not how to retrieve it. While componentization, the relational model, relational algebra, and declarative programming techniques and their respective benefits are well known, they have not been applied together in an existing system.

As a counter-example, the Microsoft Windows Presentation Foundation (formerly named “Avalon”) explicitly mixes declarative descriptions of visual layouts with imperative (non-declarative) procedural code (see “Code Name Avalon: Create Real Apps Using New Code and Markup Model”, MSDN Magazine, January 2004). Microsoft states that [imperative] programming languages are “clunky for the job of laying out text, images, and controls”, and declarative (“markup”) approaches are “hopelessly inept when it comes time to interact with the user”. Thus both approaches must be used together in Avalon. The declarative part of the application (“XAML”) must be supplemented by “real [imperative] programming code”, which is embedded directly in XAML or placed in a separate file.

Thus there is a need for techniques for designing and assembling applications using data-access components based on a relational model and relational algebra.

SUMMARY OF THE INVENTION

The present invention provides a system and method for constructing componentized applications based on declarative programming including relational databases and relational algebra.

For example, in one aspect of the present invention, a method of constructing a software application is provided. A data model of the application is represented as a relational model. Control logic of the application is defined as a mapping from a current state of the application data model and one or more current application inputs to a new state of the application data model and one or more application outputs, described by relational algebra.

In this embodiment of the present invention a user-interface of the application may be represented as a declarative view component model. The user-interface may enable user interaction to facilitate application flow. Application flow evaluates one or more inputs to the data model, updates the state of the data model in accordance with the one or more inputs, and updates the user-interface in accordance with the state of the data model. Additionally, the mapping of relational algebra components may comprise an interconnection of encapsulated components.

In additional embodiments of the present invention, an apparatus and an article of manufacture for constructing a user interactive software application are provided.

The embodiments of the present invention allow a model, view, and controller to all be specified in a declarative fashion, avoiding the need to adapt between declarative and procedural/imperative styles within the application description.

These and other objects, features and advantages of the present invention will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is screen capture of a sample software application, CRUD++, according to an embodiment of the present invention;

FIG. 2 is a diagram illustrating an architectural description of a create operation for the sample software application, according to an embodiment of the present invention;

FIG. 3 is a diagram illustrating an architectural description of an update operation for the sample software application, according to an embodiment of the present invention;

FIG. 4 is a diagram illustrating an architectural description of a delete operation for the sample software application, according to an embodiment of the present invention;

FIG. 5 is a diagram illustrating an architectural description of an increment operation for the sample software application, according to an embodiment of the present invention;

FIG. 6 is a diagram illustrating an architectural description of a view update for the sample software application, according to an embodiment of the present invention;

FIG. 7 is a flow diagram illustrating an interactive software application construction methodology, according to an embodiment of the present invention;

FIG. 8 is a flow diagram illustrating a software application flow methodology, according to an embodiment of the present invention; and

FIG. 9 is a block diagram illustrating an exemplary hardware implementation of a computing system in accordance with which one or more components/methodologies may be implemented, according to an embodiment of the present invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

As will be illustrated in detail below, the present invention introduces techniques for constructing a user interactive software application based on a relational model and relational algebra. More specifically, the present invention will be explained below in the context of an illustrative application, CRUD++ (create, retrieve, update, delete and increment). The application is illustrative in that it shows how a graphical user-interface (GUI) front end enables users to drive the four basic database operations (create, retrieve, update and delete), as well as perform an application-specific function (increment). However, it is to be understood that the present invention is not limited to such a particular software application environment. Rather, the invention is more generally applicable to the description and implementation of any application which may be described in terms of a model-view-controller software architecture scheme.

Referring initially to FIG. 1, a screen capture of the sample CRUD++ application is provided. The application allows the user to create, retrieve, update, and delete mappings from a specified name to a specified value. The current value associated with a specified name may also be incremented, if it is a numeric value. A desired operation of the software application is selected via radio buttons disposed on the left side of the screen capture, or view.

Referring now to FIG. 2, a diagram illustrates an architectural description of a create operation for the sample software application, according to an embodiment of the present invention. FIG. 2 provides a common application model 1000, a common application view 2000, and a common application controller 3000.

View 2000 may be designed in a graphical editor tool, such as, for example, IBM Rational Web Developer for WebSphere Software (see “IBM Rational Web Developer for WebSphere Software Version 6.0”, IBM Publication GC34-2465-00, 2004), or Macromedia Dreamweaver (see “Dreamweaver MX 2004: The Missing Manual”, ISBN 0596006314, O'Reilly Media, Inc., 2003). View 2000 contains two text-entry fields, name field 2010 and value field 2020. The text-entry fields are GUI widgets such as, for example, Eclipse standard widget toolkit (SWT), Java Swing or another widget technology. All operations require a text entry in name field 2010 to be supplied by the user; however the retrieve, delete, and increment operations do not require such a text entry in value field 2020. In accordance with the embodiments of the present invention, the user-supplied text in name field 2010 is denoted as name and the user-supplied text in value field 2020 is denoted as value.

View 2000 is connected to a relational algebra description of controller 3000, expressed as a graph of components which represent relational algebra operations. In the preferred embodiment of the present invention, the relational algebra operations are modeled on relational algebra “A” as described in C. J. Date et al., “Foundation for Object/Relational Databases: The Third Manifesto,” ISBN 0-201-30978-5 (Chapter 4). In other embodiments, alternative formulations of relational algebra, which are known to those skilled in the art, may be used. Note that in the preferred embodiment, the outputs of the view components are architected as relations, so that they are compatible with the relational-algebra blocks of controller 3000, and the relational model 1000.

The application model 1000 that comprises the data used by the application is described in terms of a relational database. FIG. 2 illustrates model 1000 having a single relation, NameValue, comprised of two attributes, that associates a name with a value. The relational database of model 1000 may be designed by a tool such as, for example IBM Rational Application Developer for WebSphere (see “IBM Rational Application Developer for WebSphere Software Version 6.0”, IBM Publication GC34-2464-00), or DDS-Pro.

The description of application controller 3000 is provided in a declarative fashion so that it is integrated with view 2000 and model 1000, and may be executed directly from the application description. In the preferred embodiment of the present invention, the application description is in a graphical form, although other embodiments may be used, such as, for example, extensible markup language (XML). Further, in the preferred embodiment of the present invention, the application description may be compiled into an intermediate form before execution.

FIG. 2 shows the preferred embodiment for the description of the create operation in the sample CRUD++ application. Text entries, name, in name field 2010, and value, in value field 2020, are passed to an AND block 3020 which produces a tuple containing <Name name, Value value>. This tuple is connected to OR block 3010, which produces a new value for model 1000 containing the previous contents of model 1000 plus the additional tuple. This creates the name, value pair in the database. Note that model 1000 is only updated through an enable signal 1100, when create radio button 2030 is selected from view 2000.

Referring now to FIG. 3, a diagram illustrates an architectural description of an update operation for the sample software application, according to an embodiment of the present invention. A text entry, name, in name field 2010, is connected to a NOT block 3120, which performs a relation-complement operation. More specifically, the output of block 3120 contains every name except name specified by name field 2010. The output of NOT block 3120 and the current contents of model 1000 are passed to an AND block 3110 to produce an output having any tuples containing name removed. Text entries, name and value, are connected to an AND block 3130 to produce a tuple <Name name, Value value>. The tuple from AND block 3130 is connected to an OR block 3100 together with the result of AND 3110 to produce the new value for model 1000 containing an updated Value value for Name name. Note that model 1000 is only updated through enable signal 1100, when an update radio button 2050 is selected from view 2000.

Referring now to FIG. 4, a diagram illustrates an architectural description of a delete operation for the sample software application, according to an embodiment of the present invention. Text entry, name, from name field 2010 is connected to a NOT block 3210 which performs a relation-complement operation. The output of NOT block 3210 and the current contents of model 1000 are passed to an AND block 3200 to produce an output with any tuples containing name removed. Note that model 1000 is only updated through enable signal 1100, when a delete radio button 2060 is selected from view 2000.

Referring now to FIG. 5, a diagram illustrates an architectural description of an increment operation for the sample software application, according to an embodiment of the present invention. Text entry, name, from name field 2010 is connected to a NOT block 3320 which performs a relation-complement operation. The output of NOT block 3320 and the current contents of model 1000 are passed to an AND block 3310 to produce an output with any tuples containing name removed. Text entry, name, from name field 2010 is also connected to an AND block 3330 which also receives the current value of model 1000. AND block 3330 produces a tuple containing <Name name, Value value>, where value is the current value of name in model 1000. <Name name, Value value> is connected to a combinatorial expression block 3340 which adds 1 to value, producing a new tuple <Name name, Value value +1>. This tuple is fed to OR block 3300, together with the output of AND block 3310. The output of OR block 3300 is the new content of model 1000 with <Name name, Value value +1> replacing <Name name, Value value>. Note that model 1000 is only updated through enable signal 1100, when an “++(increment)” radio button 2070 is selected from view 2000.

Referring now to FIG. 6, a diagram illustrates an architectural description of a view update for the sample software application, according to an embodiment of the present invention. View 2000 may be updated in response to selection of a retrieve operation or an increment operation. Text entry, name, from name field 2010 is fed to an AND block 3410 together with the current content of model 1000 to produce a tuple <Name name, Value value>, where value is the current value of name. Value field 2020 in view 2000 is updated with value through enable signal 2090, when a retrieve 2040 or ++ (increment) 2080 radio button is selected, as determined by combinatorial expression block 3400. Note that in the preferred embodiment, updateable view components are architected in a manner similar to that of model 1000, in that their interfaces are relations, so that they are compatible with the output(s) of controller 3000 and model 1000. In the preferred embodiment, updateable view components are provided with an enable input, so that controller 3000 can control whether they are updated.

Referring now to FIG. 7, a flow diagram illustrates an interactive software application construction methodology, according to an embodiment of the present invention. The methodology begins in block 702 where a data model of the application is represented as a relational model. For example, a relational model is illustrated as model 1000 in FIGS. 2-6. In block 704, control logic of the application is defined as a mapping from the current application state and application inputs to a new application state and application outputs, described by relational algebra components. For example, control logic is illustrated in controller 3000 in FIGS. 2-6. One or more transitions between states of the data model are described as application flow. Finally, in block 706, a user-interface of the application is represented as a declarative view component model. For example, a user-interface is illustrated as view 2000 in FIGS. 2-6. Note that in alternative embodiments (e.g. non-visual or non-interactive (batch) applications), step 706 may be modified or omitted.

Referring now to FIG. 8, a flow diagram illustrates a software application flow methodology, according to an embodiment of the present invention. In the preferred embodiment, applications may be executed directly from their graphical descriptions.

The methodology begins in block 802 where all inputs to model 1000 are evaluated. For example, in FIG. 2, enable input 1100 from create radio button 2030 and the output of OR block 3010 would be evaluated. In the preferred embodiment of the present invention, evaluation proceeds recursively. More specifically, an evaluation of OR block 3010 triggers an evaluation of AND block 3020. This continues until the recursion terminates at the current state of model 1000 and/or the current state of view 2000. In the preferred embodiment, relational-algebra blocks of controller 3000 form a directed acyclic graph (DAG), so that a recursive evaluation algorithm eventually terminates successfully. Those skilled in the art will recognize that other evaluation strategies are possible for the relational algebra blocks.

In block 804 of FIG. 8, model 1000 is updated with the values computed in step 802. For example, in FIG. 2, model 1000 is updated to include the new tuple <Name name, Value value>. Finally, in block 806, view 2000 is updated using input values from view 2000 and updated model 1000. For example, in FIG. 6, Value 2020 is updated with a value attribute from AND block 3410, if retrieve radio button 2040 or ++(increment) radio button 2080 is selected.

In the preferred embodiment, the execution of the algorithm of FIG. 8 is triggered by events from the view component(s). For example, clicking a button or entering text will cause execution of the algorithm of FIG. 8. In other embodiments, non-view actions, such as database triggers, may cause the execution of the algorithm of FIG. 8.

Referring now to FIG. 9, a block diagram illustrates an exemplary hardware implementation of a computing system in accordance with which one or more components/methodologies of the invention (e.g., components/methodologies described in the context of FIGS. 1-8) may be implemented, according to an embodiment of the present invention.

As shown, the computer system may be implemented in accordance with a processor 910, a memory 912, I/O devices 914, and a network interface 916, coupled via a computer bus 918 or alternate connection arrangement.

It is to be appreciated that the term “processor” as used herein is intended to include any processing device, such as, for example, one that includes a CPU (central processing unit) and/or other processing circuitry. It is also to be understood that the term “processor” may refer to more than one processing device and that various elements associated with a processing device may be shared by other processing devices.

The term “memory” as used herein is intended to include memory associated with a processor or CPU, such as, for example, RAM, ROM, a fixed memory device (e.g., hard drive), a removable memory device (e.g., diskette), flash memory, etc.

In addition, the phrase “input/output devices” or “I/O devices” as used herein is intended to include, for example, one or more input devices (e.g., keyboard, mouse, etc.) for entering data to the processing unit, and/or one or more output devices (e.g., speaker, display, printer, etc.) for presenting results associated with the processing unit.

Still further, the phrase “network interface” as used herein is intended to include, for example, one or more transceivers to permit the computer system to communicate with another computer system via an appropriate communications protocol.

The present invention can be realized in hardware, software, or a combination of hardware and software. It may be implemented as a method having steps to implement one or more functions of the invention, and/or it may be implemented as an apparatus having components and/or means to implement one or more steps of a method of the invention described above and/or known to those skilled in the art. Any kind of computer system—or other apparatus adapted for carrying out the methods and/or functions described herein—is suitable. A typical combination of hardware and software could be a general purpose computer system with a computer program that, when being loaded and executed, controls the computer system such that it carries out the methods described herein. The present invention can also be embedded in a computer program product, which comprises all the features enabling the implementation of the methods described herein, and which—when loaded in a computer system—is able to carry out these methods. Methods of this invention may be implemented by an apparatus which provides the functions carrying out the steps of the methods. Apparatus and/or systems of this invention may be implemented by a method that includes steps to produce the functions of the apparatus and/or systems.

Computer program means or computer program in the present context include any expression, in any language, code or notation, of a set of instructions intended to cause a system having an information processing capability to perform a particular function either directly or after conversion to another language, code or notation, and/or after reproduction in a different material form.

Thus, the invention includes an article of manufacture which comprises a computer usable medium having computer readable program code means embodied therein for causing one or more functions described above. The computer readable program code means in the article of manufacture comprises computer readable program code means for causing a computer to effect the steps of a method of this invention. Similarly, the present invention may be implemented as a computer program product comprising a computer usable medium having computer readable program code means embodied therein for causing a function described above. The computer readable program code means in the computer program product comprising computer readable program code means for causing a computer to affect one or more functions of this invention. Furthermore, the present invention may be implemented as a program storage device readable by machine, tangibly embodying a program of instructions executable by the machine to perform method steps for causing one or more functions of this invention.

It is noted that the foregoing has outlined some of the more pertinent objects and embodiments of the present invention. This invention may be used for many applications. Thus, although the description is made for particular arrangements and methods, the intent and concept of the invention is suitable and applicable to other arrangements and applications. It will be clear to those skilled in the art that modifications to the disclosed embodiments can be effected without departing from the spirit and scope of the invention. The described embodiments ought to be construed to be merely illustrative of some of the more prominent features and applications of the invention. Other beneficial results can be realized by applying the disclosed invention in a different manner or modifying the invention in ways known to those familiar with the art. 

1. A method of constructing a software application comprising the steps of: representing a data model of the application as a relational model; and defining control logic of the application as a mapping from a current state of the application data model and one or more current application inputs to a new state of the application data model and one or more application outputs, described by relational algebra.
 2. The method of claim 1, further comprising the step of representing a user-interface of the application as a declarative view component model.
 3. The method of claim 2, wherein, in the step of representing a user-interface, the user-interface comprises text entry fields.
 4. The method of claim 2, wherein, in the step of representing a user-interface, the user-interface enables user interaction to facilitate a change from the current state of the application data model to a new state of the application data model.
 5. The method of claim 4, wherein, in the step of representing a user-interface, the user interaction drives at least one of basic database operations and an application specific function.
 6. The method of claim 4, wherein the change from the current state to the new state of the application data model comprises the steps of: evaluating one or more inputs to the data model; updating the state of the data model in accordance with the one or more inputs; and updating the user-interface in accordance with the state of the data model.
 7. The method of claim 6, wherein, in the step of evaluating one or more inputs, the evaluation is recursive until a state of the data model or of the user interface is defined.
 8. The method of claim 2, wherein, in the step of representing a user-interface, the user-interface components have relational outputs.
 9. The method of claim 2, wherein, in the step of representing a user-interface, the user-interface components have relational inputs.
 10. The method of claim 1, wherein, in the step of defining an application controller, the mapping described by relational algebra comprises an interconnection of encapsulated components.
 11. The method of claim 1, wherein, in the step of defining control logic, the mapping described by relational algebra comprises a directed-acyclic graph of components.
 12. The method of claim 1, wherein the software application comprises a user-interactive software application.
 13. Apparatus for constructing a software application, comprising: a memory; and at least one processor coupled to the memory and operative to: represent a data model of the application as a relational model; and define control logic of the application as a mapping from a current state of the application data model and one or more current application inputs to a new state of the application data model and one or more application outputs, described by relational algebra.
 14. The apparatus of claim 13, wherein the processor is further operative to represent a user-interface of the application as a declarative view component model.
 15. The apparatus of claim 14, wherein, in the operation of representing a user-interface, the user-interface enables user interaction to facilitate a change from the current state of the application data model to a new state of the application data model.
 16. The apparatus of claim 15, wherein the change from the current state to the new state of the application data model comprises the steps of: evaluating one or more inputs to the data model; updating the state of the data model in accordance with the one or more inputs; and updating the user-interface in accordance with the state of the data model.
 17. The apparatus of claim 14, wherein, in the operation of representing a user-interface, the user-interface components have relational outputs.
 18. The apparatus of claim 14, wherein, in the operation of representing a user-interface, the user-interface components have relational inputs.
 19. A computer program product comprising a computer usable medium having computer readable program code means embodied therein for causing construction of a software application, the computer readable program code means in said computer program product comprising computer readable program code means for causing a computer to effect the functions of claim
 13. 20. An article of manufacture for constructing a software application, comprising a machine readable medium containing one or more programs which when executed implement the steps of: representing a data model of the application as a relational model; and defining control logic of the application as a mapping from a current state of the application data model and one or more current application inputs to a new state of the application data model and one or more application outputs, described by relational algebra. 